unit ListUtils;

interface

uses SysUtils, Classes;

type
  TsmStringList = class(TStringList)
  private
    FDelimiter :Char;
  public
    constructor create;
    property Delimiter :Char read FDelimiter write FDelimiter;
    procedure setDelimText(Value :string);
  end;


implementation

{ TsmStringList }

constructor TsmStringList.create;
begin
  inherited Create;
  FDelimiter:=';';
end;

procedure TsmStringList.setDelimText(Value: string);
var
  P,
  Start :PChar;
  S     :string;
  i    :integer;
begin
  BeginUpdate;
  try
    Clear;
    P := Pointer(Value);
    if P <> nil then
      while P^ <> #0 do
      begin
        Start := P;
        while not (P^ in [#0, FDelimiter]) do Inc(P);
        SetString(S, Start, P - Start);
        Add(S);
        if P^ = FDelimiter then Inc(P);
      end;
    for i:=0 to Count-1 do
      Strings[i]:=Trim(Strings[i]);
  finally
    EndUpdate;
  end;
end;


end.
 